Python for the Life Sciences by Alexander Lancaster & Gordon Webster

Python for the Life Sciences by Alexander Lancaster & Gordon Webster

Author:Alexander Lancaster & Gordon Webster
Language: eng
Format: epub, pdf
ISBN: 9781484245231
Publisher: Apress


Interesting! Python gives you a convenient shortcut for testing whether numerical variables have non-zero values, or whether ordered collections like strings and lists are empty or not (in other words, whether or not they are of zero length). But getting back to our multi-well plate code… if check:

if not loc in self.validate['position1D']:

raise Exception('Invalid 1D Plate Position: %s' % str(loc))

If the check is set to True, the input coordinate loc is searched for in the appropriate list in the validate dictionary that we created in the Plate class constructor, and if it’s not there, we raise an Exception, terminating the program with an appropriate error message.

Let’s assume that loc checks out as valid and look at what happens in that case. In the next two lines of code, we calculate the row and column indexes corresponding to the input coordinate. row = int(math.ceil(float(loc)/float(self.columns))) - 1

col = loc - (row * self.columns) - 1



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.